from utils.predictor import SiameseImageComparator
from utils.config import parse_args  # type: ignore
from utils.init_model import init_model  # type: ignore # 导入 init_model 函数

if __name__ == "__main__":
   # 解析命令行参数
   args = parse_args()
   args.backbone = 'densenet'
   args.backbone_version = 'densenet161'
   args.distance_type = "cosine" # ['l1', 'euclidean', 'mahalanobis', 'cosine']

   # 根据自己的数据集和模型路径调整
   args.inference_model_path = "model_data/exp_densenet_densenet161_cosine_2025_01_13_09_25_06.pth"
   args.template_img_path = 'imgs/frame_570.jpg'
   args.match_waited_img_path = 'imgs/frame_575.jpg'

   # 初始化模型
   Match_Model = init_model(args)

   # 初始化比较器
   comparator = SiameseImageComparator(model_path=args.inference_model_path, match_model=Match_Model, save_img_name="save_img_results")
   similarity = comparator.compare_images(args.template_img_path, args.match_waited_img_path)
   print("Similarity: ", similarity)